<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="/template/template.xhtml"
	xmlns:s="http://sduept.security.el/func">
	<ui:define name="head">
		<title>新设备启动及并网管理</title>
		<link rel="stylesheet"
			href="/resources/plugins/datatables/dataTables.bootstrap.css" />
		<script src="/resources/js/calendarLocale.js"></script>
		<style type="text/css">
.ui-datatable-scrollable-header-box {
	margin-left: 0px;
	margin-right: 15px !important;
}

iframe {
	width: 100%;
	height: 600px;
}

.ui-datalist-empty-message {
	/* height: 100px; */
	min-height: 100px;
}

.ui-datalist-content {
	/* height: 100px; */
	min-height: 100px;
}

.correct {
	color: green;
}

.error {
	color: red;
}

.center {
	text-align: center;
}
</style>
	</ui:define>
	<ui:define name="content">
		<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
			<p:commandButton value="是" type="button"
				styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
			<p:commandButton value="否" type="button"
				styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
		</p:confirmDialog>
		<div id="headDiv" class="box box-solid with-border">
			<h:form id="headForm">
				<div class="box-header" id="queryDiv">
					<p:outputLabel for="start" value="时间：" />
					<p:calendar id="start" navigator="true"
						value="#{newDeviceController.queryDate1}" pattern="yyyy-MM-dd"
						maxdate="Date()">
					</p:calendar>
					<p:outputLabel for="end" value="至 "
						style="margin-right:5px;margin-left:5px;" />
					<p:calendar id="end" navigator="true"
						value="#{newDeviceController.queryDate2}" pattern="yyyy-MM-dd"
						maxdate="Date()">
					</p:calendar>
					<p:commandButton value="查询" id="query"
						update="form:dataTb toolbar_s" icon="ui-icon-search"
						actionListener="#{newDeviceController.queryByTime}"
						style="margin-left:5px;" oncomplete="getTableScrollHeight();">
					</p:commandButton>
					<p:commandButton icon="ui-icon-refresh" value="重置"
						actionListener="#{newDeviceController.resetQuery}"
						style="margin-left:5px;" update="start end toolbar_s form:dataTb "
						oncomplete="getTableScrollHeight();" />
				</div>
				<div id="toolbarDiv">
					<p:toolbar id="toolbar_s">
						<f:facet name="left">
							<p:growl id="msgs" showDetail="true" />
							<p:commandButton id="cgBtn31" value="新建" icon="ui-icon-document"
								update="diaForm:createDlg"
								actionListener="#{newDeviceController.createDevices}"
								oncomplete="PF('createDlg').show()"
								rendered="#{s:hasPermission(session,'bhyx_bhrb_xsbqdjbwgl_xj')}" />
							<p:commandButton update="diaForm:createDlg"
								actionListener="#{newDeviceController.preEdit}"
								oncomplete="PF('createDlg').show()" icon="ui-icon-pencil"
								value="编辑"
								rendered="#{s:hasPermission(session,'bhyx_bhrb_xsbqdjbwgl_bj')}"
								disabled="#{newDeviceController.selectDevice == null}">
							</p:commandButton>
							<p:commandButton value="删除" icon="ui-icon-trash"
								update="form:dataTb headForm:msgs headForm:toolbar_s"
								actionListener="#{newDeviceController.deleteDevices}"
								disabled="#{newDeviceController.selectDevice == null}"
								rendered="#{s:hasPermission(session,'bhyx_bhrb_xsbqdjbwgl_sc')}"
								oncomplete="getTableScrollHeight();">
								<p:confirm header="提示" message="确定删除该记录吗?" icon="ui-icon-alert" />
							</p:commandButton>
						</f:facet>
					</p:toolbar>
				</div>
			</h:form>
		</div>
		<div id="infoDiv" class="box box-solid with-border">
			<h:form id="form">
				<p:dataTable id="dataTb" var="item"
					value="#{newDeviceController.devices}"
					selection="#{newDeviceController.selectDevice}" rowKey="#{item.id}"
					style="margin-bottom:0" emptyMessage="无记录" rows="20"
					paginator="true" rowsPerPageTemplate="20,50,100"
					paginatorPosition="bottom" rowIndexVar="ite"
					paginatorTemplate="{Customization} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					scrollable="true">
					<f:facet name="{Customization}">
						<p:outputLabel
							value="总计：#{newDeviceController.devices.size()} 条记录"
							style="margin-right:20px;"></p:outputLabel>
					</f:facet>
					<p:ajax event="rowSelectRadio"
						listener="#{newDeviceController.deviceRowSelect}"
						update="headForm:toolbar_s"></p:ajax>
					<p:column selectionMode="single" width="10"
						style="text-align:center" />
					<p:column width="30" headerText="序号 ">
						<h:outputText value="#{ite+1}" />
					</p:column>
					<p:column width="50" headerText="所属地区 ">
						<h:outputText value="#{item.belongArea}" />
					</p:column>
					<p:column width="50" headerText="工程名称 ">
						<h:outputText value="#{item.projectName}" />
					</p:column>
					<p:column width="60" styleClass="center" headerText="工程资料管理">
						<h:outputLabel
							styleClass="#{newDeviceController.getStyleClass(item.projectDataMag)}"
							value="#{item.projectDataMag}" />
					</p:column>
					<p:column width="80" styleClass="center" headerText="厂站CT配置图">
						<h:outputLabel
							styleClass="#{newDeviceController.getStyleClass(item.substationCTMap)}"
							value="#{item.substationCTMap}" />
					</p:column>
					<p:column width="60" styleClass="center" headerText="保护及通道命名">
						<h:outputLabel
							styleClass="#{newDeviceController.getStyleClass(item.protectChannel)}"
							value="#{item.protectChannel}" />
					</p:column>
					<p:column width="80" styleClass="center" headerText="定值核查及备案">
						<h:outputLabel
							styleClass="#{newDeviceController.getStyleClass(item.valueInspect)}"
							value="#{item.valueInspect}" />
					</p:column>
					<p:column width="80" styleClass="center" headerText="电厂跳闸清册">
						<h:outputLabel
							styleClass="#{newDeviceController.getStyleClass(item.plantTripRecord)}"
							value="#{item.plantTripRecord}" />
					</p:column>
					<p:column width="80" styleClass="center" headerText="保信系统接入">
						<h:outputLabel
							styleClass="#{newDeviceController.getStyleClass(item.prudentialSystemAccess)}"
							value="#{item.prudentialSystemAccess}" />
					</p:column>
					<p:column width="80" styleClass="center" headerText="新设备投产期验收">
						<h:outputLabel
							styleClass="#{newDeviceController.getStyleClass(item.newEquiIn)}"
							value="#{item.newEquiIn}" />
					</p:column>
					<p:column width="80" styleClass="center" headerText="定值整定及下发">
						<h:outputLabel
							styleClass="#{newDeviceController.getStyleClass(item.valueSetting)}"
							value="#{item.valueSetting}" />
					</p:column>
					<p:column width="80" styleClass="center" headerText="需其他专业配合工作">
						<h:outputLabel
							styleClass="#{newDeviceController.getStyleClass(item.otherMajor)}"
							value="#{item.otherMajor}" />
					</p:column>
				</p:dataTable>
			</h:form>
			<h:form id="diaForm">
				<p:dialog widgetVar="createDlg"
					header="#{newDeviceController.created.id == null?'新建':'编辑'}"
					modal="true" id="createDlg" width="800">
					<p:toolbar>
						<f:facet name="left">
							<p:commandButton value="保存" update="form:dataTb headForm:msgs headForm:toolbar_s "
								icon="ui-icon-disk"
								oncomplete="PF('createDlg').hide();getTableScrollHeight();"
								actionListener="#{newDeviceController.saveNew}" />
						</f:facet>
					</p:toolbar>
					<p:outputPanel id="createDetail"
						style="text-align:center;width:100%;">
						<p:panelGrid rendered="#{not empty newDeviceController.created}"
							style="width:100%;">
							<p:row>
								<p:column>
									<h:outputText value="工程名称：" />
								</p:column>
								<p:column colspan="5">
									<p:inputText required="true" requiredMessage="工程名称为必填项！"
										style="width:100%;"
										value="#{newDeviceController.created.projectName}" />
								</p:column>
							</p:row>
							<p:row>
								<p:column>
									<h:outputText value="所属地区：" />
								</p:column>
								<p:column colspan="5">
									<p:inputText style="width:100%;" required="true"
										requiredMessage="所属地区为必填项！"
										value="#{newDeviceController.created.belongArea}" />
								</p:column>
							</p:row>
							<p:row>
								<p:column>
									<h:outputText value="工程资料管理：" />
								</p:column>
								<p:column>
									<p:triStateCheckbox value="#{newDeviceController.bs0}" />
								</p:column>
								<p:column>
									<h:outputText value="厂站CT配置图：" />
								</p:column>
								<p:column>
									<p:triStateCheckbox value="#{newDeviceController.bs1}" />
								</p:column>
								<p:column>
									<h:outputText value="保护及通道命名：" />
								</p:column>
								<p:column>
									<p:triStateCheckbox value="#{newDeviceController.bs2}" />
								</p:column>
							</p:row>
							<p:row>
								<p:column>
									<h:outputText value="定值核查及备案：" />
								</p:column>
								<p:column>
									<p:triStateCheckbox value="#{newDeviceController.bs3}" />
								</p:column>
								<p:column>
									<h:outputText value="电厂跳闸清册：" />
								</p:column>
								<p:column>
									<p:triStateCheckbox value="#{newDeviceController.bs4}" />
								</p:column>
								<p:column>
									<h:outputText value="信保系统接入：" />
								</p:column>
								<p:column>
									<p:triStateCheckbox value="#{newDeviceController.bs5}" />
								</p:column>
							</p:row>
							<p:row>
								<p:column>
									<h:outputText value="新设备投产期验收：" />
								</p:column>
								<p:column>
									<p:triStateCheckbox value="#{newDeviceController.bs6}" />
								</p:column>
								<p:column>
									<h:outputText value="定值整定及下发：" />
								</p:column>
								<p:column>
									<p:triStateCheckbox value="#{newDeviceController.bs7}" />
								</p:column>
								<p:column>
									<h:outputText value="需其他专业配合工作：" />
								</p:column>
								<p:column>
									<p:triStateCheckbox value="#{newDeviceController.bs8}" />
								</p:column>
							</p:row>
						</p:panelGrid>
					</p:outputPanel>
				</p:dialog>
			</h:form>
		</div>
	</ui:define>
	<ui:define name="contentend">
		<script src="/resources/js/tables/singleScrollTable.js" />
	</ui:define>
</ui:composition>
